<template>
  <div class="app-container" style="padding: 0px;position:relative;">
    <div style="color: #72A4FF;font-size: 20px;font-weight: bold;">告警信息</div>
    <div class="myTable">
      <el-table class="myTable" :data="paramAlarmRecList" :max-height="380" :cell-style="set_cell_style" style="margin-right: -30px;">
        <el-table-column label="报警内容" align="left" prop="pointName" >
          <template slot-scope="scope">
            <span>{{ scope.row.pointName }}|{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d} {h}:{i}') }}{{ scope.row.alarmTxt }}</span>
          </template>
        </el-table-column>
        <!--<el-table-column label="告警时间" align="center" prop="alarmTime" >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d} {h}:{i}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="告警内容" align="left" prop="alarmTxt" />-->
      </el-table>
    </div>
  </div>
</template>

<script>
  import { parseTime } from "@/utils/ruoyi";
  import { listParamAlarmRec } from "@/api/basic/paramAlarmRec";

  export default {
    components: {},
    data() {
      return {
        dateRange: "",
        paramAlarmRecList:[],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 99999,
        },
      };
    },
    mounted() {
      let nowDate = new Date();
      let endTime = parseTime(nowDate,'{y}-{m}-{d} {h}:{i}:{s}');
      let befDate = new Date(nowDate.getTime() - 7 * 24 * 3600 * 1000);
      let startTime = parseTime(befDate,'{y}-{m}-{d} {h}:{i}:{s}');
      this.dateRange = [startTime,endTime];
      this.getList();
    },
    created() {

    },
    methods: {
      getList() {
        this.loading = true;
        listParamAlarmRec(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
          this.paramAlarmRecList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      set_cell_style({ row, column, rowIndex, columnIndex }) {
        return "padding:0;margin-left:-10px;margin-right:-10px;";
      },
    },
  };
</script>
